#!/bin/tcsh -f
#SBATCH --job-name=frepp.tropical_storms_wsfc.csh
#SBATCH --time=18:00:00
#SBATCH --ntasks=2
#SBATCH --output=$HOME/msub_output/%A_%a.out

# **********************************************************************
# TCtracker - Tropical Storm Detection
# Copyright (C) 1997-2008, 2021 Frederic Vitart, Joe Sirutis, Ming Zhao,
# Kyle Olivo, Keren Rosado and Seth Underwood
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# **********************************************************************

set fremodule

# Initialize the module environment
source $MODULESHOME/init/csh
module use -a /home/fms/local/modulefiles
module purge
module load $fremodule

set name = `basename $0`

# set paths to tools
set work_script = $FRE_ANALYSIS_HOME/keo/tstorms/bin/tropical_storms_wsfc

set echo
# ============== VARIABLES SET BY FREPP =============
# original arguments passed to this script when it was created by frepp
set argu
# path to NetCDF files postprocessed by frepp, as specified in XML
set in_data_dir
# experiment name (as appears in output directory names)
set descriptor
# final output directory for diagnostics generated by this script
set out_dir
# actual start/end years of diagnostics (start_year & end_year in XML)
set yr1
set yr2
# ============== END OF VARIABLES SET BY FREPP =============

# If any arguments were supplied on the command line, then those
# will replace the original frepp-supplied arguments.
if ($#argv) set argu = ($argv:q)

# =============== START BODY OF SCRIPT ==============

$work_script -b $yr1 -e $yr2 -n $descriptor -i $in_data_dir -o $out_dir $argu:q

# ================ END BODY OF SCRIPT ===============
unset echo

exit 0
